daemon.htmlTEXTMOSS±‡±·Bj∑qÃÓ∑qÃÓÅÅÀy
DaemonCron Lite 1.5.3
Freeware for Macintosh OS 9.1
DaemonCron Lite 1.5.3
This page last updated: Wed, July 11, 2001
Copyright © 1998-2001 by Xochitl Sodality Daemon Works
All Rights Reserved
[FAQ]
[Abstract]
[History]
[User's Manual]
[Disclaimer]
[Download]
[Email]
ABSTRACT
This small daemon posts messages to the screen, and will launch applications, documents, AppleScripts, sound files, etc., on any schedule you set. Possible uses include nagging yourself (via Notification Manager alerts or AppleScripts), launching Netscape at 3 A.M. to drive your cat nuts, whining soulfully when someone else is using your computer, turning your house lights on or off (requires wiring and additional stuff not provided), doing things at startup or shutdown, listening to your ex's dead dog bark every now and then, and so forth. Hey, it's daemonic! Use your imagination!
Those who already know what this is about will see other possibilities, of course. One I find useful is the ability to launch apps in a particular order at startup. The only thing in my Startup Items folder is DaemonCron Lite.
DaemonCron is freeware for private use. Corporate, educational or government users should buy the one-time, flat-rate, world-wide license for US$15.
Requires PowerPC and OS 7.5 or better (OS 9.1 recommended). Requires ResEdit or Resorcerer for configuration, and you should be comfortable with no-holds-barred system spelling bees when you configure launchfile names. ;-)
NOTE: Support for 68k machines has been discontinued.
HISTORY
1.5.3 - 11 July 2001 - DaemonCron Alarm is automatically updated on the minute, if the file has been modified. Annihilated a minor bug introduced in 1.5.1.
1.5.1 - 6 July 2001 - Added desktop alarms. Also new, anything after semicolon in a crontab is ignored, unless preceded by +, the notification signal.
1.5 - 6 June 2001 - Removed the seriously outdated PlaySound code because it was asynchronous and too buggy under OS 9. Sounds are now managed by launching sound files instead.
Also, enhanced the random cron so that users may “tune” how often a random item (usually a sound file) will be launched. Fixed a bug that forced
DaemonCron to play ALL the random crons, instead of selecting one at random.
1.0.2 - launch documents as well as apps
1.0.1 - 4 April 1998 - fixed possible hang on exit
DaemonCron Lite 1.0 - 1 April 1998 - added the launch in background switch - feature freeze - code freeze - DaemonCron Pro will have AppleEvents/AppleScript support, ability to read a reminder text dropped on the desktop, asynchronous sound, and maybe a graphical user interface provided by a companion application (at the moment, schedules are easily edited using ResEdit -- if that's not Mac, what is? ;-) Maybe a click on DaemonCron Prefs will launch DaemonCron, which will launch the companion to edit the schedule tables. DaemonCron will read changes without having to stop and restart. There may be some other AppleScript-able features worth looking into, which will be controlled from the companion app. DaemonCron Lite is still freeware for personal use and now packs a fair repertoire into 20k, including completely debugged versions of minute, hour, day, month and day-of-week scheduling, ability to launch apps in foreground or background, ability to play sounds on schedule, ability to post messages via Notification Manager at specified times, and the ability to recognize other specialized event categories besides startup and shutdown, executing separate crontabs for each event category. It sits in a 64k partition. There are even a couple of Easter Eggs waiting to be discovered! ;-)
1.0b8 - not released - fixed a potential exit problem with Notifications pending
1.0b7 - 31 March 1998 - fixed an extremely stupid bug (I was ReleaseResource-ing a DetachResource'd handle!)
1.0b6 - released March 31, 1998 - golden release candidate - added optional Prefs file support, enforced the System 7.5.5 requirement. Added a restart script.
1.0b5 - not released, minor fixes and additions
1.0b4 - released March 30, 1998 - added Notifications, minor bug fixes, in particular, ResEdit could not read a Resorcerer TMPL resource.
1.0b3 - not released - added additional Cron settings
1.0b2 - released March 29, 1998
USER'S MANUAL
DaemonCron is a true faceless background application, not an extension, control panel or INIT. It is well-behaved, and will respond to a system shutdown request (the kAEQuitApplication Apple Event). Its partition is very large, although seemingly small by recent standards -- only 128k. The file itself is only about 20k!
Because it is a true background application, the Mac OS does not give it an ordinary application's update/activate events, which means that DaemonCron has no user interaction, except one-way via the Notification Manager.
Although configuring DaemonCron is straightforward, you may have to experiment a bit before it does exactly as you wish. However, persevere! Wrestle with your daemon. Once it works, it works beautifully.
Although DaemonCron can read a preferences file, it does not create any documents, and will not write on your hard drive or anywhere in memory outside its own partition. It launches applications and documents and posts notifications to the screen, period.
When starting up, DaemonCron looks for its (optional) DaemonCron Prefs file in the current working directory (where DaemonCron started up); if not found, it then looks in the system Preferences folder; and if not found, it uses its own builtin default resources. DaemonCron must restart before it notices any settings changes - there is a script to do this.
-
Desktop alarms (NEW!)
- At startup, DaemonCron Lite 1.5.1 will look for a file called DaemonCron Alarm on the desktop. This is an ordinary text file containing ordinary cron
commands in the syntax documented below. You can create and edit the file using BBEdit or SimpleText.
This file is used for any ad hoc alarms you wish to set. The cron commands in this file are scanned every minute, just like ordinary crons. After startup, the DaemonCron Alarm file will be read in again every quarter hour, and any new or updated commands will be noted.
If you need to set an alarm that executes BEFORE the next quarter hour, restart DaemonCron. Otherwise, any change will be noticed well before you need it.
If the DaemonCron Alarm file is trashed (or simply moved off the desktop into a convenient folder), alarms will be turned off at the next update on the quarter hour.
Configure DaemonCron Prefs using ResEdit, available from Apple Computer. The edited file should be put back into the same folder as DaemonCron or else in the Preferences folder in your startup System Folder. There are two area of interest: Cron #128 contains somes values and flags you may feel you need to tweak; also, there are eight TEXT resources which contain cron commands.
- Cron sleep value
- The Cron resource (there is only one, #128, with three fields) contains a sleep value (in ticks), which you may adjust if you feel it necessary. Specify 60 to indicate 1 second. This is the amount of time that DaemonCron gives back to the system between events. By default, DaemonCron wants to be hit once a second. If you do not run as a clock, and you don't care about being up to a half-minute off on scheduled tasks, you can set this value to 1800.
A higher value may make other programs and applications running on your Mac more responsive, but you pay for it in imprecise timing. A value less than 60 will certainly make your system less responsive. Although I can't imagine a case where you would want to make the sleep value less than 60, you may not be so unimaginative as I frequently prove to be. The ability is there if you need it.
I have run the benchmark tests in TechTool Pro 2.0.1 against Mac OS 8.1 running with and without the daemon, and find the resulting changes small and maybe even a little baffling. You can decide what those numbers mean (what's a Dhrystone, to Netscape Navigator?). To me, with a sleep value of 60 or 75, there does not seem to be much impact on my system. In my primary application, the Metrowerks Codewarrior compiler, for example, having the daemon running seems to have little or no effect on normal compile times.
- Match day of week, if not date?
- Some cron users feel there is an ambiguity about "day of week" versus "day of month" specifications. For example, if the user specifies 0 12 29 3 1, meaning 12 noon on Sunday, March 29, the only years in which this is likely to be meaningful are 1998 and 2009. If you want the Sunday specification to override the date, turn this flag on by entering a 1. Otherwise, leave it at 0.
- Random cron factor (0=off,1..60)?
- In earlier versions, this was a pretty useless “Notify on errors?” flag. DaemonCron now always notifies you if a launch fails, and this setting selects
how often (on average) the Random Cron will be launched. Zero turns off random crons. Otherwise, the cron will probably launch once every 1 to 60 minutes, but
your mileage will definitely vary. Random crons are normally either fortune cookies displayed by the Notification Manager or else annoying/friendly little sounds launched every
now and then to keep your cat happy or confused, etc.
In legacy DaemonCron prefs, this will have the wrong name in ResEdit, and the value will be set too low — most people will prefer a value closer to 60 than 1.
Cron commands
There are four TEXT resources, which together make up the DaemonCron's task list. DaemonCron recognizes normal, startup, shutdown and random tasks.
The commands you place in these TEXT resources will be executed with the following precedence:
1. Startup tasks run first
2. Tasks scheduled for any minute, hour, day of the month or week
3. Random tasks (maybe one or more per hour)
4. Shutdown tasks run last
Each of these task lists may be as extensive as you like, from no task executing at all, to several. The lists are divided by logical type to cut down the amount of time DaemonCron uses to process its task list. If you add more than a few tasks, you may find you need to increase DaemonCron's partition size. To remove all tasks from a TEXT resource, select all and backspace -- do not remove the TEXT resource itself!
The task syntax is derived from Unix cron's crontab format. These are examples of task strings:
- * * * * * beep
- this string means beep every minute, every hour, every day, every month, all week
- 35 7 * * * MacHD:Eudora Pro Folder:Eudora Pro 1.1.1
- this command means launch Eudora at 7:35 AM every day
The five asterisks from left to right may be replaced by numbers:
minute * 0-59
hour * 0-23
day * 1-31
month * 1-12
day of week * 1=Sunday, 2=Monday, ... , 7=Saturday (see DateTimeRec)
command message, or path name to an application, document, sound file, etc.
example +Duck, here comes a duck! ; Note: comments follow a semicolon (v1.5.1)
No lists, please. Just a single * (means "any") or one number per field, separated by a single space (no tabs).
Hint: If a command seems to fail, look for a missing space between numbers or asterisks! Also look for misspelled words. There must be five asterisks or numbers, followed by a command.
A command containing a colon is interpreted as an application or document path name, and will be launched if possible. You should give a fully-qualified path name, e.g. MacHD:Eudora Pro Folder:Eudora Pro 1.1.1. Do not use quotes, unless the filename itself contains quotes. Documents and AppleScripts are launched via Apple Events sent to the Finder. With a path name, therefore, you can do anything you like, including using AppleScript to kill a running application!
A command with a leading plus sign, '+', is passed to the Notification Manager. The user sees it as a somewhat startling dialog box. The leading plus sign is stripped off. Notifications do not stack up. The notification on screen is the most recent, not the first in an unanswered series. Any pending notifications on exit are purged.
If you add a lot of cron commands, you will almost certainly slow down your system a bit. Also, you may need to increase DaemonCron's partition size. I have always been able to launch anything I spelled right. If the total size of your resource fork is less than about 18k, you should be ok, but I haven't tested these limits.
I have included a representative sample of Cron commands that I actually use, to serve as a reasonable example base.
Hint: You might discover a couple of "Easter Eggs" by reading those TEXT resources... ;-)
Hint: My copy of Resorcerer cannot type a plain apostrophe into a TEXT record, for some reason. You may have to cut and paste the actual sound name from your System suitcase or from the Finder.
As one last hint, I would encourage you to learn a little about AppleScript. That tool and this one together make a wonderfully powerful synergy. I've included two scripts that you might like to look at, although they are very simple indeed.
That's all! Enjoy!
Disclaimer
This program is distributed "AS IS". It will absolutely not be supported except through public updates or bug fixes issued at my sole discretion. I make absolutely no warranty as to its fitness for a particular service, and I will absolutely not be responsible for any real or imagined incidental or consequential damage, loss or grievance caused by your use of, or your inability to use, this program. This program may contain inadvertent errors (however unlikely) which may destroy your file system, your sanity, your livelihood, your children's hope for the future, peace in our time and/or the last chance of the gods at Götterdämmerung. Use it entirely at your own risk and discretion.
Warning This program is neither designed nor intended for use in life-threatening situations (such as medical emergency) or other time-critical applications where life or
property may be at hazard!
However, if you decide you like it, you may (optional for personal use) send a check for US$15 to me at:
David C. Oshel
507 32nd Street SE
Cedar Rapids, Iowa 52403
Click here to download the software (34k): [I Agree!]
You will need Stuffit Expander to install DaemonCron Lite.
P.S. Any financial valentines I collect this way go straight into my daughter's college fund.
[Top]
This resource fork intentionally left blank ˇˇ